package SV_AUTH_BYPASS_MIGHT;

import javax.servlet.ServletException;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class Fixed {

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Map<String, String> result = new HashMap<>();

        if (! AuthenticateUser(request.getParameter("username"), "..." )) { // user authentication
            System.out.println("Error: you need to log in first");
        }
       else {
            Cookie loggedIn = new Cookie("loggedIn", "true");
           //...
        }
    }

    private boolean AuthenticateUser(String username, String s) {
        return false;
    }
}
